package com.extra;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;

public class Solution1207 {
    public boolean uniqueOccurrences(int[] arr) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int x : arr) {
            map.put(x, map.getOrDefault(x, 0) + 1);
        }
        Set<Integer> integers = map.keySet();
        HashMap<Integer, Integer> map1 = new HashMap<>();
        for (int x : integers) {
            if (map1.containsKey(map.get(x))) return false;
            map1.put(map.get(x), 1);
        }
        return true;
    }
}
